<{*卡券列表*}>
<{include file="top.html" }>
</head>
<body>

<div class="xy-panel">
    <div class="xy-panel-top">
        <div class="xy-titlebar">
            <div class="xy-titlebar-left">
                <a class="insertBefore_left_arrow_gray left_link" href="javascript:void(0);"></a>
            </div>
            <div class="xy-titlebar-title">卡券</div>
            <div class="xy-titlebar-right">
                <div class="spacer"></div>
                <{*<a href="javascript:void(0);">帮助</a>*}>
            </div>
        </div>
    </div>
    <div class="xy-panel-content">
        <{if $list}>
            <ul class="ticketList append-html" id="theList">
                <{include file="Card/item.html" }>
            </ul>
            <div id="load_container">
                <{if $nextPage==1}>
                <a href="javascript:load_more();" id="load_more"><span>加载更多</span></a><br>
                <{/if}>
            </div>
        <{else}>
            <div class="none-box">
                <span class="card-icon"></span>
                <dl>您还没有任何卡券</dl>
            </div>
        <{/if}>
    </div>
    <div class="xy-panel-bottom">
        <a class="insertAfter_right_arrow_gray" style="color:#666" href="<{U('history')}>">查看历史卡券</a>
    </div>
</div>
<{include file="signBody.html"}>
</body>
</html>
<script>

    var $list = $("#theList");
    var $listParent = $list.parent();
    var isLoading = false;
    var page = 2;
    function  load_more(postData){
        if(isLoading) return;
        isLoading = true;
        if(postData == null){
            postData = {page:page,pos:"cardListMore"};
        }
        $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
        $("#load_more  span").html('正在加载...');
        $.post("<{u('cardListMore')}>",postData  ,  function(data){
            isLoading = false;
            if(data.data) {
                $(".append-html").append(data.data);
                $("#load_more  span").html('加载更多');
                page++;
                $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
            } else {
                $("#load_container").html('<a  href="javascript:;"  id="load_more"><span>没有更多卡券啦</span></a>');
                $("#load_more").css({'background':'url("")'}).css({'padding-top':'0'}).css({'top':'0px'}).css({'position':'relative'});
            }
        },'json');
    }
    var  tmp_scroll  =  0;
    //拖动加载
    function  scroll_load(postData){
        if  (tmp_scroll == $(window).height() + $(window).scrollTop()){return;}
        tmp_scroll  =  $(window).height() + $(window).scrollTop();
        var  jia_scroll  =  $(document).height()  -  ($(window).height()  +  $(window).scrollTop());
        if  (jia_scroll < 100 && flagData){
            load_more( postData );
        }
    }

    $listParent.scroll(function(){
        var v = $list.height() - $listParent.height() - $listParent.scrollTop();
        if(v < 10)
        {
            load_more({page:page,pos:"cardListMore"});
        }
    });

</script>


